/**
 * 
 */
package com.game.jumpdino;

//import com.google.ads.AdSenseSpec;
//import com.google.ads.GoogleAdView;
//import com.google.ads.AdSenseSpec.AdType;

import com.game.jumpdino.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;

/**
 * @author HugoGu
 *
 */
public class GameOver extends Activity {
	Animation clickAnimation;
	// Replace with your own AdSense client ID.
    private static final String CLIENT_ID = "ca-mb-app-pub-0512298971600735";

    // Replace with your own company name.
    private static final String COMPANY_NAME = "TT mobile Tech, Inc";

    // Replace with your own application name.
    private static final String APP_NAME = "Jumping Panda";

    // Replace with your own keywords used to target Google ad.
    // Join multiple words in a phrase with '+' and join multiple phrases with ','.
    private static final String KEYWORDS = "Jumping Panda,Disney,Kids,accident,lawyer";

    // Replace with your own AdSense channel ID.
    private static final String CHANNEL_ID = "7059354229";
//    private GoogleAdView adView;
    
    @Override
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState);
        setContentView(R.layout.over);
    
        
//        GoogleAdView adView = (GoogleAdView) findViewById(R.id.adview);
//        AdSenseSpec adSenseSpec =
//           new AdSenseSpec(CLIENT_ID)     // Specify client ID. (Required)
//            .setCompanyName(COMPANY_NAME)  // Set company name. (Required)
//            .setAppName(APP_NAME)          // Set application name. (Required)
//            .setKeywords(KEYWORDS)         // Specify keywords.
//            .setChannel(CHANNEL_ID)        // Set channel ID.
//            .setAdType(AdType.TEXT)        // Set ad type to Text.
//            .setAdTestEnabled(false);       // Keep true while testing.
//        adView.showAds(adSenseSpec);
        clickAnimation = AnimationUtils.loadAnimation(this, R.anim.click);
    	clickAnimation.reset();
    }
    
    public void onRestartClick(View target){
    	runAnimations(target, new AnimationListener()
    	{
			public void onAnimationEnd(Animation animation) {
		        Intent intent = new Intent();
		        intent.setClass(GameOver.this, JumpingPanda.class); 
		        startActivity(intent);
		        finish();
			}

			public void onAnimationRepeat(Animation animation) {				
			}

			public void onAnimationStart(Animation animation) {				
			}    		
    	});
    }
    
    public void onExitClick(View target){
    	finish();
    }
    
    private void runAnimations(View tv, AnimationListener listener) {
    	clickAnimation.setAnimationListener(listener);
	    tv.clearAnimation();
	    tv.startAnimation(clickAnimation);
	}
}
